/*
 * Copyright 2025 arisgo@163.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.arisgo.cloud.attendance.clazz.core.arrange.strategy;

import com.arisgo.cloud.attendance.clazz.core.arrange.MatchStore;
import com.arisgo.cloud.attendance.clazz.core.arrange.MatchStrategy;
import com.arisgo.cloud.attendance.clazz.vo.ClassInfoVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * 规则匹配  RuleMatch
 *   > 时间以一天为准
 *   > 按照班的岗位要求，在指定范围内匹配满足条件的员工
 *   > 注意岗位的人数要求
 *   > 此方法以班为准，人不一定都会有班
 *
 * @author xu keqi
 * @since 2025-03-29
 */
@Slf4j
@Component
@AllArgsConstructor
public class RuleMatch implements MatchStrategy, InitializingBean {

    public static final String KEY = "ruleMatch";

    private final MatchStore matchStore;

    @Override
    public void match(List<ClassInfoVo> infos, List<Long> staffIds) {
        if (CollectionUtils.isEmpty(infos) || CollectionUtils.isEmpty(staffIds)) {
            log.warn("排班策略 => 参数为空！");
            return;
        }
        log.info("排班策略 => 规则匹配暂未实现，敬请期待！");
        // TODO 2025-03-29 后续再实现
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        matchStore.add(KEY, this);
    }
}
